-- =============================================
-- Create table [MAItems]
-- =============================================
IF OBJECT_ID('[MAItems]', 'U') IS NOT NULL
	DROP TABLE [MAItems]
GO

CREATE TABLE [MAItems]					
(
	[LocaleCd] VARCHAR(50), -- [ItemName], [ItemSearchName], [Notes] 
	[ItemCd] VARCHAR(50),
	[ItemName] NVARCHAR(255),
	[ItemSearchName] VARCHAR(255),	
	[ItemDiv] VARCHAR(50),
  ----- Add -start #1.1 -----
  [TypeCd] VARCHAR(50),
  ----- Add -end #1.1 -----
  ----- Delete -start #1.1 -----
	-- [CategoryCd] VARCHAR(50),
  -- [DimensionCd] VARCHAR(50),
  ----- Delete -end #1.1 -----
  [ExemplarCd] VARCHAR(50),
  [FileCd] VARCHAR(50),
  [ViewCount] DECIMAL(18,0),
	[Notes] NVARCHAR(MAX),
	[SortKey] DECIMAL(18,0),
	[VersionNo] DECIMAL(18,0),
	[CreateUser] VARCHAR(50),
	[CreateDate] DATETIME,
	[UpdateUser] VARCHAR(50),
	[UpdateDate] DATETIME,
	[DeleteFlag] BIT,
	PRIMARY KEY ([LocaleCd], [ItemCd])
)
GO

EXEC sys.sp_addextendedproperty @level2name=N'LocaleCd', @value=N'Mã ngôn ngữ', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
EXEC sys.sp_addextendedproperty @level2name=N'ItemCd', @value=N'Mã sản phẩm', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
EXEC sys.sp_addextendedproperty @level2name=N'ItemName', @value=N'Tên sản phẩm', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
EXEC sys.sp_addextendedproperty @level2name=N'ItemSearchName', @value=N'Tên tìm kiếm', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
EXEC sys.sp_addextendedproperty @level2name=N'ItemDiv', @value=N'Loại sản phẩm (sản phẩm mới, sản phẩm hot, ...)', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
----- Add -start #1.1 -----
EXEC sys.sp_addextendedproperty @level2name=N'TypeCd', @value=N'Mã loại', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
----- Add -end #1.1 -----
----- Delete -start #1.1 -----
-- EXEC sys.sp_addextendedproperty @level2name=N'CategoryCd', @value=N'Mã thể loại', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
-- EXEC sys.sp_addextendedproperty @level2name=N'DimensionCd', @value=N'Mã kích thước', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
----- Delete -end #1.1 -----
EXEC sys.sp_addextendedproperty @level2name=N'ExemplarCd', @value=N'Mã mẩu (màu khác)', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
EXEC sys.sp_addextendedproperty @level2name=N'FileCd', @value=N'Mã file', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
EXEC sys.sp_addextendedproperty @level2name=N'ViewCount', @value=N'Số lượt xem', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
EXEC sys.sp_addextendedproperty @level2name=N'Notes', @value=N'Ghi chú', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
EXEC sys.sp_addextendedproperty @level2name=N'SortKey', @value=N'Thứ tự', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
EXEC sys.sp_addextendedproperty @level2name=N'VersionNo', @value=N'Phiên bản', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
EXEC sys.sp_addextendedproperty @level2name=N'CreateUser', @value=N'Người tạo', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
EXEC sys.sp_addextendedproperty @level2name=N'CreateDate', @value=N'Ngày tạo', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
EXEC sys.sp_addextendedproperty @level2name=N'UpdateUser', @value=N'Người cập nhật', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
EXEC sys.sp_addextendedproperty @level2name=N'UpdateDate', @value=N'Ngày cập nhật', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
EXEC sys.sp_addextendedproperty @level2name=N'DeleteFlag', @value=N'Hoạt động', @level0name=N'dbo', @level1name=N'MAItems', @name=N'MS_Description', @level0type=N'SCHEMA', @level1type=N'TABLE', @level2type=N'COLUMN'
GO